#ifndf _HANDLE_
#define _HANDLE_ 1
class point{
public:
    point():xval(0),yval(0){}
    point(int x,int y):xval(x),yval(y){}
    int x()const{return xval;}
    int y()const{return yval;}
    point& x(int xv){xval=xv;return *this;}
    point& y(int yv){yval=yv;return *this;}
private:
    int xval,yval;
};
class HP{
public:
    HP();
    HP(int,int);
    HP(point const&);
    HP(HP const&);
    HP& operator=(HP const&);
    ~HP();

    int x() const;
    HP& x(int);
    int y() const;
    HP& y(int);
private:
    UHP*up;
};
class UHP{
friend class HP;
    point p;
    int u;

    UHP():u(1){}
    UHP(int x,int y):p(x,y),u(1){}
    UHP(point const& p0):p(p0),u(1){}
};
#endif
//https://www.geeksforgeeks.org/dynamic-memory-allocation-in-c-using-malloc-calloc-free-and-realloc/